Tutorial Brief

This is an a review of how to use IPython Notebooks.

Data Sources

Loading the data using Pandas


In [1]:
import pandas as pd
#This line is to make float division the default. For int division use //
from __future__ import division

In [2]:
path = "data/2014_indian_election_turnout.csv"
csv_data = pd.read_csv(path)
csv_data


Out[2]:
State PC Name Male Electors Male Voters Female Electors Female Voters Total Electors Total Voters
0 Andaman & Nicobar Islands 1 - Andaman & Nicobar Islands 142782 101178 126578 89150 269360 190328
1 Andhra Pradesh 1 - Adilabad 687389 519364 698844 526475 1386233 1045839
2 Andhra Pradesh 2 - Peddapalle 725767 520598 699594 501586 1425361 1022184
3 Andhra Pradesh 3 - Karimnagar 777458 552489 773376 573202 1550834 1125691
4 Andhra Pradesh 4 - Nizamabad 724504 469712 771689 564212 1496193 1033924
5 Andhra Pradesh 5 - Zahirabad 717811 546746 727435 548060 1445246 1094806
6 Andhra Pradesh 6 - Medak 775903 606863 760812 584233 1536715 1191096
7 Andhra Pradesh 7 - Malkajgiri 1723413 878093 1459912 742304 3183325 1620397
8 Andhra Pradesh 8 - Secundrabad 1012378 545749 881269 458020 1893647 1003769
9 Andhra Pradesh 9 - Hyderabad 961290 526510 862374 444911 1823664 971421
10 Andhra Pradesh 10 - CHELVELLA 1153049 696749 1032130 619113 2185179 1315862
11 Andhra Pradesh 11 - Mahbubnagar 709711 511764 708961 503036 1418672 1014800
12 Andhra Pradesh 12 - Nagarkurnool 745038 570342 732300 538626 1477338 1108968
13 Andhra Pradesh 13 - Nalgonda 747281 602193 748299 587206 1495580 1189399
14 Andhra Pradesh 14 - Bhongir 756963 622333 735288 589610 1492251 1211943
15 Andhra Pradesh 15 - Warangal 771756 592484 766025 582147 1537781 1174631
16 Andhra Pradesh 16 - Mahabubabad 688398 562073 698945 562297 1387343 1124370
17 Andhra Pradesh 17 - Khammam 712329 588728 727960 594169 1440289 1182897
18 Andhra Pradesh 18 - Aruku 622416 451350 650308 458264 1272724 909614
19 Andhra Pradesh 19 - Srikakulam 706828 505010 707161 546436 1413989 1051446
20 Andhra Pradesh 20 - Vizianagaram 700837 555005 703290 565311 1404127 1120316
21 Andhra Pradesh 21 - Visakhapatnam 875187 585270 847850 578288 1723037 1163558
22 Andhra Pradesh 22 - Anakapalli 689132 563818 712342 584254 1401474 1148072
23 Andhra Pradesh 23 - Kakinada 709101 558689 709189 541310 1418290 1099999
24 Andhra Pradesh 24 - Amalapuram 682607 568534 675259 552393 1357866 1120927
25 Andhra Pradesh 25 - Rajahmundry 701707 577999 719581 576382 1421288 1154381
26 Andhra Pradesh 26 - Narsapuram 652668 539357 672475 549594 1325143 1088951
27 Andhra Pradesh 27 - Eluru 706916 597603 720844 604093 1427760 1201696
28 Andhra Pradesh 28 - Machilipatnam 675774 567908 693537 573157 1369311 1141065
29 Andhra Pradesh 29 - Vijayawada 781156 602198 783357 592877 1564513 1195075
30 Andhra Pradesh 30 - Guntur 773027 617483 798989 627443 1572016 1244926
31 Andhra Pradesh 31 - Narasaraopet 748465 638080 766396 643978 1514861 1282058
32 Andhra Pradesh 32 - Bapatla 686482 587223 706483 597411 1392965 1184634
33 Andhra Pradesh 33 - Ongole 736245 603025 734238 605200 1470483 1208225
34 Andhra Pradesh 34 - Nandyal 783266 603562 793862 601394 1577128 1204956
35 Andhra Pradesh 35 - Kurnool 738791 544802 743016 520930 1481807 1065732
36 Andhra Pradesh 36 - Anantapur 775509 612890 761403 592164 1536912 1205054
37 Andhra Pradesh 37 - Hindupur 734638 601932 711865 575325 1446503 1177257
38 Andhra Pradesh 38 - Kadapa 765036 588805 785543 611857 1550579 1200662
39 Andhra Pradesh 39 - Nellore 796583 593468 809557 594180 1606140 1187648
40 Andhra Pradesh 40 - Tirupati 778778 604834 795766 608230 1574544 1213064
41 Andhra Pradesh 41 - Rajampet 735347 573019 752151 585298 1487498 1158317
42 Andhra Pradesh 42 - Chittoor 723996 598259 728145 600656 1452141 1198915
43 Arunachal Pradesh 1 - ARUNACHAL WEST 219334 159978 227181 175687 446515 335665
44 Arunachal Pradesh 2 - ARUNACHAL EAST 160293 129313 152579 131978 312872 261291
45 Assam 1 - Karimganj 615198 482484 550799 404436 1165997 886920
46 Assam 2 - Silchar 554540 428949 505635 370881 1060175 799830
47 Assam 3 - Autonomous District 358880 279409 343010 263871 701890 543280
48 Assam 4 - Dhubri 798124 709191 754430 660433 1552554 1369624
49 Assam 5 - Kokrajhar 776071 636657 729405 587212 1505476 1223869
50 Assam 6 - Barpeta 755559 634405 674616 571458 1430175 1205863
51 Assam 7 - Gauhati 988067 785494 934203 726235 1922270 1511729
52 Assam 8 - Mangaldoi 791539 651272 724137 581965 1515676 1233237
53 Assam 9 - Tezpur 654866 505643 604702 475045 1259568 980688
54 Assam 10 - Nowgong 792424 639392 731457 590682 1523881 1230074
55 Assam 11 - Kaliabor 752785 605292 705080 561198 1457865 1166490
56 Assam 12 - Jorhat 634236 483829 600212 447507 1234448 931336
57 Assam 13 - Dibrugarh 579657 462412 544648 428556 1124305 890968
58 Assam 14 - Lakhimpur 735263 572334 695731 539641 1430994 1111975
59 Bihar 1 - Valmiki Nagar 786297 484621 670279 415493 1456576 900114
... ... ... ... ... ... ... ...

543 rows × 8 columns

Understanding the data

  • State: State Name.
  • PC Name: Parliamentary Constituencies Names.
  • Male Electors: The number of elegeble male voters.
  • Male Voters: The number of male voters turnout.
  • Female Electors: The number of elegeble female voters.
  • Female Voters: The number of female voters turnout.
  • Total Electors: The number of elegeble voters.
  • Total Voters: The number of voters turnout.

Calculating Turnout


In [3]:
csv_data["Male Turnout"] = csv_data["Male Voters"] / csv_data["Male Electors"]
csv_data["Female Turnout"] = csv_data["Female Voters"] / csv_data["Female Electors"]
csv_data["Total Turnout"] = csv_data["Total Voters"] / csv_data["Total Electors"]

Statistical Analysis of Turnout


In [4]:
csv_data.describe()


Out[4]:
Male Electors Male Voters Female Electors Female Voters Total Electors Total Voters Male Turnout Female Turnout Total Turnout
count 543.000000 543.000000 543.000000 543.000000 543.000000 543.000000 543.000000 543.000000 543.000000
mean 804883.127072 540030.900552 731215.360958 479861.918969 1536098.488029 1019892.819521 0.680646 0.663664 0.672688
std 165950.096614 105316.219120 127159.414206 96137.678162 288064.231735 192716.272135 0.100641 0.111115 0.102917
min 25433.000000 21585.000000 24489.000000 21654.000000 49922.000000 43239.000000 0.283097 0.232644 0.259047
25% 728644.000000 491359.000000 691996.500000 430761.500000 1425052.000000 940426.500000 0.608490 0.578545 0.592252
50% 814968.000000 549484.000000 740045.000000 484001.000000 1555779.000000 1033783.000000 0.680857 0.656567 0.667207
75% 899919.500000 597803.000000 791426.500000 540898.000000 1692364.500000 1129424.500000 0.763453 0.756988 0.755237
max 1723413.000000 878093.000000 1459912.000000 742304.000000 3183325.000000 1620397.000000 0.888572 0.892712 0.882175

8 rows × 9 columns

Quick Facts

Total Electors


In [5]:
print '{0:,}'.format(csv_data["Total Electors"].sum())


834,101,479

Gender Ration (Men to Women)


In [6]:
print '%.2f%%' % (csv_data["Female Electors"].sum() / csv_data["Male Electors"].sum()*100)


90.85%

Total Voters


In [7]:
print '{0:,}'.format(csv_data["Total Voters"].sum())


553,801,801

Total Turnout


In [8]:
print '%.2f%%' % (csv_data["Total Voters"].sum() / csv_data["Total Electors"].sum() * 100)


66.40%

Analyzing States


In [9]:
states = pd.DataFrame(csv_data["State"].unique(), columns=["State"])
print "The number of states: %s" % len(states)
states


The number of states: 35
Out[9]:
State
0 Andaman & Nicobar Islands
1 Andhra Pradesh
2 Arunachal Pradesh
3 Assam
4 Bihar
5 Chandigarh
6 Chattisgarh
7 Dadra & Nagar Haveli
8 Daman & Diu
9 Goa
10 Gujarat
11 Haryana
12 Himachal Pradesh
13 Jammu & Kashmir
14 Jharkhand
15 Karnataka
16 Kerala
17 Lakshadweep
18 Madhya Pradesh
19 Maharashtra
20 Manipur
21 Meghalaya
22 Mizoram
23 Nagaland
24 NCT OF Delhi
25 Orissa
26 Puducherry
27 Punjab
28 Rajasthan
29 Sikkim
30 Tamil Nadu
31 Tripura
32 Uttar Pradesh
33 Uttarakhand
34 West Bengal

35 rows × 1 columns


In [10]:
# Calculating constituencies
seats = csv_data["State"].value_counts()
states["Seats"] = seats.sort_index().values
states.sort("Seats", ascending=False)


Out[10]:
State Seats
32 Uttar Pradesh 80
19 Maharashtra 48
34 West Bengal 42
1 Andhra Pradesh 42
4 Bihar 40
30 Tamil Nadu 39
18 Madhya Pradesh 29
15 Karnataka 28
10 Gujarat 26
28 Rajasthan 25
25 Orissa 21
16 Kerala 20
3 Assam 14
14 Jharkhand 14
27 Punjab 13
6 Chattisgarh 11
11 Haryana 10
23 Nagaland 7
13 Jammu & Kashmir 6
33 Uttarakhand 5
12 Himachal Pradesh 4
9 Goa 2
21 Meghalaya 2
20 Manipur 2
2 Arunachal Pradesh 2
31 Tripura 2
5 Chandigarh 1
17 Lakshadweep 1
7 Dadra & Nagar Haveli 1
8 Daman & Diu 1
22 Mizoram 1
24 NCT OF Delhi 1
26 Puducherry 1
29 Sikkim 1
0 Andaman & Nicobar Islands 1

35 rows × 2 columns

Calculating Total States Electors and Voters


In [11]:
total_electors = pd.pivot_table(csv_data, values="Total Electors", rows=["State"], aggfunc="sum")
total_votes = pd.pivot_table(csv_data, values="Total Voters", rows=["State"], aggfunc="sum")
states["Total Electors"] = total_electors.sort_index().values
states["Total Voters"] = total_votes.sort_index().values
states.sort("Total Electors", ascending=False)


Out[11]:
State Seats Total Electors Total Voters
32 Uttar Pradesh 80 138965820 81092302
19 Maharashtra 48 80717283 48718844
1 Andhra Pradesh 42 64938750 48358545
4 Bihar 40 63761796 35885366
34 West Bengal 42 62833128 51622555
30 Tamil Nadu 39 55114505 40620440
18 Madhya Pradesh 29 48118040 29639796
15 Karnataka 28 46212109 31038888
28 Rajasthan 25 42969447 27110044
10 Gujarat 26 40603104 25824003
25 Orissa 21 29196041 21532275
16 Kerala 20 24326649 17975893
14 Jharkhand 14 20326743 12982940
27 Punjab 13 19608008 13845132
3 Assam 14 18885274 15085883
6 Chattisgarh 11 17623049 12255579
11 Haryana 10 16097749 11495150
23 Nagaland 7 12711236 8271766
13 Jammu & Kashmir 6 7202163 3566863
33 Uttarakhand 5 7129939 4391890
12 Himachal Pradesh 4 4810071 3098501
31 Tripura 2 2388819 2023859
20 Manipur 2 1774325 1412637
21 Meghalaya 2 1567241 1078058
24 NCT OF Delhi 1 1182948 1038910
9 Goa 2 1060777 817000
26 Puducherry 1 901357 740017
2 Arunachal Pradesh 2 759387 596956
22 Mizoram 1 702170 433201
5 Chandigarh 1 615214 453455
29 Sikkim 1 370611 308967
0 Andaman & Nicobar Islands 1 269360 190328
7 Dadra & Nagar Haveli 1 196617 165286
8 Daman & Diu 1 111827 87233
17 Lakshadweep 1 49922 43239

35 rows × 4 columns

Calculating State Turnout


In [12]:
states["Turnout"] = states["Total Voters"] / states["Total Electors"]
states.sort("Turnout", ascending=False)


Out[12]:
State Seats Total Electors Total Voters Turnout
24 NCT OF Delhi 1 1182948 1038910 0.878238
17 Lakshadweep 1 49922 43239 0.866131
31 Tripura 2 2388819 2023859 0.847222
7 Dadra & Nagar Haveli 1 196617 165286 0.840650
29 Sikkim 1 370611 308967 0.833669
34 West Bengal 42 62833128 51622555 0.821582
26 Puducherry 1 901357 740017 0.821003
3 Assam 14 18885274 15085883 0.798817
20 Manipur 2 1774325 1412637 0.796155
2 Arunachal Pradesh 2 759387 596956 0.786102
8 Daman & Diu 1 111827 87233 0.780071
9 Goa 2 1060777 817000 0.770190
1 Andhra Pradesh 42 64938750 48358545 0.744679
16 Kerala 20 24326649 17975893 0.738938
25 Orissa 21 29196041 21532275 0.737507
5 Chandigarh 1 615214 453455 0.737069
30 Tamil Nadu 39 55114505 40620440 0.737019
11 Haryana 10 16097749 11495150 0.714084
0 Andaman & Nicobar Islands 1 269360 190328 0.706593
27 Punjab 13 19608008 13845132 0.706096
6 Chattisgarh 11 17623049 12255579 0.695429
21 Meghalaya 2 1567241 1078058 0.687870
15 Karnataka 28 46212109 31038888 0.671661
23 Nagaland 7 12711236 8271766 0.650744
12 Himachal Pradesh 4 4810071 3098501 0.644169
14 Jharkhand 14 20326743 12982940 0.638712
10 Gujarat 26 40603104 25824003 0.636011
28 Rajasthan 25 42969447 27110044 0.630914
22 Mizoram 1 702170 433201 0.616946
18 Madhya Pradesh 29 48118040 29639796 0.615981
33 Uttarakhand 5 7129939 4391890 0.615979
19 Maharashtra 48 80717283 48718844 0.603574
32 Uttar Pradesh 80 138965820 81092302 0.583541
4 Bihar 40 63761796 35885366 0.562804
13 Jammu & Kashmir 6 7202163 3566863 0.495249

35 rows × 5 columns

Calculating Electors Per Seat


In [13]:
states["Electors Per Seat"] = states["Total Electors"] / states["Seats"]
states.sort("Electors Per Seat", ascending=False)


Out[13]:
State Seats Total Electors Total Voters Turnout Electors Per Seat
23 Nagaland 7 12711236 8271766 0.650744 1815890.857143
32 Uttar Pradesh 80 138965820 81092302 0.583541 1737072.750000
28 Rajasthan 25 42969447 27110044 0.630914 1718777.880000
19 Maharashtra 48 80717283 48718844 0.603574 1681610.062500
18 Madhya Pradesh 29 48118040 29639796 0.615981 1659242.758621
15 Karnataka 28 46212109 31038888 0.671661 1650432.464286
11 Haryana 10 16097749 11495150 0.714084 1609774.900000
6 Chattisgarh 11 17623049 12255579 0.695429 1602095.363636
4 Bihar 40 63761796 35885366 0.562804 1594044.900000
10 Gujarat 26 40603104 25824003 0.636011 1561657.846154
1 Andhra Pradesh 42 64938750 48358545 0.744679 1546160.714286
27 Punjab 13 19608008 13845132 0.706096 1508308.307692
34 West Bengal 42 62833128 51622555 0.821582 1496026.857143
14 Jharkhand 14 20326743 12982940 0.638712 1451910.214286
33 Uttarakhand 5 7129939 4391890 0.615979 1425987.800000
30 Tamil Nadu 39 55114505 40620440 0.737019 1413192.435897
25 Orissa 21 29196041 21532275 0.737507 1390287.666667
3 Assam 14 18885274 15085883 0.798817 1348948.142857
16 Kerala 20 24326649 17975893 0.738938 1216332.450000
12 Himachal Pradesh 4 4810071 3098501 0.644169 1202517.750000
13 Jammu & Kashmir 6 7202163 3566863 0.495249 1200360.500000
31 Tripura 2 2388819 2023859 0.847222 1194409.500000
24 NCT OF Delhi 1 1182948 1038910 0.878238 1182948.000000
26 Puducherry 1 901357 740017 0.821003 901357.000000
20 Manipur 2 1774325 1412637 0.796155 887162.500000
21 Meghalaya 2 1567241 1078058 0.687870 783620.500000
22 Mizoram 1 702170 433201 0.616946 702170.000000
5 Chandigarh 1 615214 453455 0.737069 615214.000000
9 Goa 2 1060777 817000 0.770190 530388.500000
2 Arunachal Pradesh 2 759387 596956 0.786102 379693.500000
29 Sikkim 1 370611 308967 0.833669 370611.000000
0 Andaman & Nicobar Islands 1 269360 190328 0.706593 269360.000000
7 Dadra & Nagar Haveli 1 196617 165286 0.840650 196617.000000
8 Daman & Diu 1 111827 87233 0.780071 111827.000000
17 Lakshadweep 1 49922 43239 0.866131 49922.000000

35 rows × 6 columns

Reading the Results


In [14]:
path = "data/2014_indian_elections_results.csv"
results_data = pd.read_csv(path, sep="\t")
results_data


Out[14]:
Name of State/ UT Parliamentary Constituency Candidate Name Total Votes Polled Winner or Not? Party Abbreviation Party Name
0 Andhra Pradesh Adilabad GODAM NAGESH 430847 yes TRS Telangana Rashtra Samithi
1 Andhra Pradesh Adilabad NETHAWATH RAMDAS 41032 no IND Independent
2 Andhra Pradesh Adilabad RAMESH RATHOD 184198 no TDP Telugu Desam
3 Andhra Pradesh Adilabad RATHOD SADASHIV 94420 no BSP Bahujan Samaj Party
4 Andhra Pradesh Adilabad MOSALI CHINNAIAH 8859 no IND Independent
5 Andhra Pradesh Adilabad NARESH 259557 no INC Indian National Congress
6 Andhra Pradesh Adilabad PAWAR KRISHNA 5055 no IND Independent
7 Andhra Pradesh Adilabad BANKA SAHADEV 4787 no IND Independent
8 Andhra Pradesh Adilabad None of the Above 17084 no NOTA None of the Above
9 Andhra Pradesh Peddapalle BALKA SUMAN 565496 yes TRS Telangana Rashtra Samithi
10 Andhra Pradesh Peddapalle None of the Above 5361 no NOTA None of the Above
11 Andhra Pradesh Peddapalle G. VIVEKANAND 274338 no INC Indian National Congress
12 Andhra Pradesh Peddapalle KALVALA SHANKAR 9290 no PPOI Pyramid Party of India
13 Andhra Pradesh Peddapalle MOUTAM RAVINDER 2674 no IND Independent
14 Andhra Pradesh Peddapalle VELTHURU MALLAIAH 45977 no RP(K) Republican Paksha (Khoripa)
15 Andhra Pradesh Peddapalle DR.JANAPATI SARAT BABU 63334 no TDP Telugu Desam
16 Andhra Pradesh Peddapalle KAMILLA JAYA RAO 2742 no IND Independent
17 Andhra Pradesh Peddapalle THALLAPALLI SRINIVAS 3699 no IND Independent
18 Andhra Pradesh Peddapalle VENKATA SWAMY INJAM 3866 no MaSP Mahajana Socialist Party
19 Andhra Pradesh Peddapalle GORRE RAMESH 2361 no IND Independent
20 Andhra Pradesh Peddapalle BUPELLI NARAYANA 7258 no IND Independent
21 Andhra Pradesh Peddapalle BOTHA VENKATA MALLAIAH 2245 no BCUF B. C. United Front
22 Andhra Pradesh Peddapalle JINNA RAMADEVI 9199 no IND Independent
23 Andhra Pradesh Peddapalle J.V. RAJU 3020 no NIP New India Party
24 Andhra Pradesh Peddapalle GADDALA VINAY KUMAR 3266 no IND Independent
25 Andhra Pradesh Peddapalle KALVALA SANJEEV 8609 no RPI Republican Party of India
26 Andhra Pradesh Peddapalle TAGARAM SHANKAR LAL 9449 no BSP Bahujan Samaj Party
27 Andhra Pradesh Karimnagar VINOD KUMAR BOINAPALLY 505783 yes TRS Telangana Rashtra Samithi
28 Andhra Pradesh Karimnagar SRINIVAS REDDY LINGAMPALLY 3865 no IND Independent
29 Andhra Pradesh Karimnagar RANAVENI LAKSHMAN 2062 no NIP New India Party
30 Andhra Pradesh Karimnagar MALLESH YADAV BARLA 2760 no IND Independent
31 Andhra Pradesh Karimnagar REDDI MALLA SRINIVAS 8040 no RPI(A) Republican Party of India (A)
32 Andhra Pradesh Karimnagar BURLA. RAVI 4769 no NCP Nationalist Congress Party
33 Andhra Pradesh Karimnagar KANDEM PRABHAKAR 4731 no IND Independent
34 Andhra Pradesh Karimnagar B. LAXMAN 11333 no BSP Bahujan Samaj Party
35 Andhra Pradesh Karimnagar SHAIK MAHMOOD 39325 no WPOI Welfare Party Of India
36 Andhra Pradesh Karimnagar PONNAM PRABHAKAR 300706 no INC Indian National Congress
37 Andhra Pradesh Karimnagar CHENNAMANENI VIDYA SAGAR RAO 214828 no BJP Bharatiya Janata Party
38 Andhra Pradesh Karimnagar MEESALA RAJI REDDY 3080 no YSRCP Yuvajana Sramika Rythu Congress Party
39 Andhra Pradesh Karimnagar MOHAMMED AMJAD MOHIUDDIN 6720 no IND Independent
40 Andhra Pradesh Karimnagar UPPULETI.LAXMAN 2448 no IND Independent
41 Andhra Pradesh Karimnagar L. PRABHAKAR REDDY 3944 no PPOI Pyramid Party of India
42 Andhra Pradesh Karimnagar PULIKOTA RAMESH 1777 no IND Independent
43 Andhra Pradesh Karimnagar DR.DHARMAIAH VENDAVETLA 3773 no BMUP Bahujan Mukti Party
44 Andhra Pradesh Karimnagar None of the Above 5747 no NOTA None of the Above
45 Andhra Pradesh Nizamabad KALVAKUNTLA KAVITHA 439307 yes TRS Telangana Rashtra Samithi
46 Andhra Pradesh Nizamabad BANJA VEERAPPA 3651 no PPOI Pyramid Party of India
47 Andhra Pradesh Nizamabad CHIRULINGADRULA VENKATESHAM 3091 no IND Independent
48 Andhra Pradesh Nizamabad KANDEM PRABHAKAR 3990 no IND Independent
49 Andhra Pradesh Nizamabad MALIK MOHTASIM KHAN 43814 no WPOI Welfare Party Of India
50 Andhra Pradesh Nizamabad S. CHANDRAIAH 2817 no IND Independent
51 Andhra Pradesh Nizamabad BAGWAN B 8129 no IND Independent
52 Andhra Pradesh Nizamabad ABDUL GANI 4791 no BCUF B. C. United Front
53 Andhra Pradesh Nizamabad ENDALA LAKSHMINARAYANA 225333 no BJP Bharatiya Janata Party
54 Andhra Pradesh Nizamabad ABDUL KAREEM KHAN (BABU) 1601 no IND Independent
55 Andhra Pradesh Nizamabad TALARI RAMULU 7421 no BSP Bahujan Samaj Party
56 Andhra Pradesh Nizamabad SAGAR SUDDALA 1978 no BMUP Bahujan Mukti Party
57 Andhra Pradesh Nizamabad MADHU YASKHI GOUD 272123 no INC Indian National Congress
58 Andhra Pradesh Nizamabad RAPELLY SRINIVAS 2621 no AAAP Aam Aadmi Party
59 Andhra Pradesh Nizamabad KOTAPATI NARSIMHAM NAIDU 2462 no IND Independent
... ... ... ... ... ... ...

8794 rows × 7 columns

Analyzing The results

In [15]:
winners = results_data[results_data["Winner or Not?"] == "yes"].sort("Name of State/ UT")
winners


Out[15]:
Name of State/ UT Parliamentary Constituency Candidate Name Total Votes Polled Winner or Not? Party Abbreviation Party Name
8548 Andaman & Nicobar Islands Andaman & Nicobar Islands BISHNU PADA RAY 90969 yes BJP Bharatiya Janata Party
0 Andhra Pradesh Adilabad GODAM NAGESH 430847 yes TRS Telangana Rashtra Samithi
9 Andhra Pradesh Peddapalle BALKA SUMAN 565496 yes TRS Telangana Rashtra Samithi
27 Andhra Pradesh Karimnagar VINOD KUMAR BOINAPALLY 505783 yes TRS Telangana Rashtra Samithi
45 Andhra Pradesh Nizamabad KALVAKUNTLA KAVITHA 439307 yes TRS Telangana Rashtra Samithi
62 Andhra Pradesh Zahirabad B.B. PATIL 508661 yes TRS Telangana Rashtra Samithi
73 Andhra Pradesh Medak KALVAKUNTLA CHANDRASEKHAR RAO 657492 yes TRS Telangana Rashtra Samithi
87 Andhra Pradesh Malkajgiri CH.MALLA REDDY 523336 yes TDP Telugu Desam
118 Andhra Pradesh Secundrabad BANDARU DATTATREYA 438271 yes BJP Bharatiya Janata Party
149 Andhra Pradesh Hyderabad ASADUDDIN OWAISI 513868 yes AIMIM All India Majlis-E-Ittehadul Muslimeen
166 Andhra Pradesh CHELVELLA KONDA VISHWESHWAR REDDY 435077 yes TRS Telangana Rashtra Samithi
182 Andhra Pradesh Mahbubnagar AP JITHENDER REDDY 334228 yes TRS Telangana Rashtra Samithi
192 Andhra Pradesh Nagarkurnool YELLAIAH NANDI 420075 yes INC Indian National Congress
199 Andhra Pradesh Nalgonda GUTHA SUKHENDER REDDY 472093 yes INC Indian National Congress
209 Andhra Pradesh Bhongir DR. BOORA NARSAIAH GOUD 448245 yes TRS Telangana Rashtra Samithi
223 Andhra Pradesh Warangal KADIYAM SRIHARI 661639 yes TRS Telangana Rashtra Samithi
236 Andhra Pradesh Mahabubabad PROF. AZMEERA SEETARAM NAIK 320569 yes TRS Telangana Rashtra Samithi
254 Andhra Pradesh Khammam PONGULETI SRINIVASA REDDY 421957 yes YSRCP Yuvajana Sramika Rythu Congress Party
282 Andhra Pradesh Aruku KOTHAPALLI GEETHA 413191 yes YSRCP Yuvajana Sramika Rythu Congress Party
294 Andhra Pradesh Srikakulam RAMMOHAN NAIDU KINJARAPU 556163 yes TDP Telugu Desam
305 Andhra Pradesh Vizianagaram ASHOK GAJAPATHI RAJU PUSAPATI 536549 yes TDP Telugu Desam
315 Andhra Pradesh Visakhapatnam KAMBHAMPATI HARI BABU 566832 yes BJP Bharatiya Janata Party
338 Andhra Pradesh Anakapalli MUTTAMSETTI SRINIVASA RAO (AVANTHI) 568463 yes TDP Telugu Desam
347 Andhra Pradesh Kakinada THOTA NARASIMHAM 514402 yes TDP Telugu Desam
370 Andhra Pradesh Amalapuram DR PANDULA RAVINDRA BABU 594547 yes TDP Telugu Desam
385 Andhra Pradesh Rajahmundry MURALI MOHAN MAGANTI 630573 yes TDP Telugu Desam
400 Andhra Pradesh Narsapuram GOKARAJU GANGA RAJU 540306 yes BJP Bharatiya Janata Party
415 Andhra Pradesh Eluru MAGANTI VENKATESWARA RAO (BABU) 623471 yes TDP Telugu Desam
431 Andhra Pradesh Machilipatnam KONAKALLA NARAYANA RAO 587280 yes TDP Telugu Desam
443 Andhra Pradesh Vijayawada KESINENI SRINIVAS 592696 yes TDP Telugu Desam
466 Andhra Pradesh Guntur JAYADEV GALLA 618417 yes TDP Telugu Desam
479 Andhra Pradesh Narasaraopet SAMBASIVA RAO RAYAPATI 632464 yes TDP Telugu Desam
491 Andhra Pradesh Bapatla MALYADRI SRIRAM 578145 yes TDP Telugu Desam
506 Andhra Pradesh Ongole Y.V.SUBBA REDDY 589960 yes YSRCP Yuvajana Sramika Rythu Congress Party
522 Andhra Pradesh Nandyal S.P.Y REDDY 622411 yes YSRCP Yuvajana Sramika Rythu Congress Party
537 Andhra Pradesh Kurnool BUTTA RENUKA 472782 yes YSRCP Yuvajana Sramika Rythu Congress Party
550 Andhra Pradesh Anantapur J.C. DIVAKAR REDDI 606509 yes TDP Telugu Desam
564 Andhra Pradesh Hindupur KRISTAPPA NIMMALA 604291 yes TDP Telugu Desam
577 Andhra Pradesh Kadapa Y.S. AVINASH REDDY 671983 yes YSRCP Yuvajana Sramika Rythu Congress Party
592 Andhra Pradesh Nellore MEKAPATI RAJAMOHAN REDDY 576396 yes YSRCP Yuvajana Sramika Rythu Congress Party
607 Andhra Pradesh Tirupati VARAPRASAD RAO VELAGAPALLI 580376 yes YSRCP Yuvajana Sramika Rythu Congress Party
622 Andhra Pradesh Rajampet P.V.MIDHUN REDDY 601752 yes YSRCP Yuvajana Sramika Rythu Congress Party
632 Andhra Pradesh Chittoor NARAMALLI SIVAPRASAD 594862 yes TDP Telugu Desam
640 Arunachal Pradesh ARUNACHAL WEST KIREN RIJIJU 169367 yes BJP Bharatiya Janata Party
649 Arunachal Pradesh ARUNACHAL EAST NINONG ERING 118455 yes INC Indian National Congress
653 Assam Karimganj RADHESHYAM BISWAS 362866 yes AIUDF All India United Democratic Front
669 Assam Silchar SUSHMITA DEV 336451 yes INC Indian National Congress
687 Assam Autonomous District BIREN SINGH ENGTI 213152 yes INC Indian National Congress
693 Assam Dhubri BADRUDDIN AJMAL 592569 yes AIUDF All India United Democratic Front
709 Assam Kokrajhar NABA KUMAR SARANIA (HIRA) 634428 yes IND Independent
716 Assam Barpeta SIRAJ UDDIN AJMAL 394702 yes AIUDF All India United Democratic Front
732 Assam Gauhati BIJOYA CHAKRAVARTY 764985 yes BJP Bharatiya Janata Party
751 Assam Mangaldoi RAMEN DEKA 486357 yes BJP Bharatiya Janata Party
764 Assam Tezpur RAM PRASAD SARMAH 446511 yes BJP Bharatiya Janata Party
774 Assam Nowgong RAJEN GOHAIN 494146 yes BJP Bharatiya Janata Party
783 Assam Kaliabor GOURAV GOGOI 443315 yes INC Indian National Congress
797 Assam Jorhat KAMAKHYA PRASAD TASA 456420 yes BJP Bharatiya Janata Party
808 Assam Dibrugarh RAMESWAR TELI 494364 yes BJP Bharatiya Janata Party
815 Assam Lakhimpur SARBANANDA SONOWAL 612543 yes BJP Bharatiya Janata Party
829 Bihar Valmiki Nagar SATISH CHANDRA DUBEY 364011 yes BJP Bharatiya Janata Party
... ... ... ... ... ... ...

543 rows × 7 columns

Loading the results to the origianl Data Frame


In [16]:
csv_data["Candidate Name"] = winners["Candidate Name"].values
csv_data["Party Abbreviation"] = winners["Party Abbreviation"].values
csv_data["Party Name"] = winners["Party Name"].values
csv_data["Total Votes Polled"] = winners["Total Votes Polled"].values
csv_data


Out[16]:
State PC Name Male Electors Male Voters Female Electors Female Voters Total Electors Total Voters Male Turnout Female Turnout Total Turnout Candidate Name Party Abbreviation Party Name Total Votes Polled
0 Andaman & Nicobar Islands 1 - Andaman & Nicobar Islands 142782 101178 126578 89150 269360 190328 0.708619 0.704309 0.706593 BISHNU PADA RAY BJP Bharatiya Janata Party 90969
1 Andhra Pradesh 1 - Adilabad 687389 519364 698844 526475 1386233 1045839 0.755561 0.753351 0.754447 GODAM NAGESH TRS Telangana Rashtra Samithi 430847
2 Andhra Pradesh 2 - Peddapalle 725767 520598 699594 501586 1425361 1022184 0.717307 0.716967 0.717140 BALKA SUMAN TRS Telangana Rashtra Samithi 565496
3 Andhra Pradesh 3 - Karimnagar 777458 552489 773376 573202 1550834 1125691 0.710635 0.741169 0.725862 VINOD KUMAR BOINAPALLY TRS Telangana Rashtra Samithi 505783
4 Andhra Pradesh 4 - Nizamabad 724504 469712 771689 564212 1496193 1033924 0.648322 0.731139 0.691037 KALVAKUNTLA KAVITHA TRS Telangana Rashtra Samithi 439307
5 Andhra Pradesh 5 - Zahirabad 717811 546746 727435 548060 1445246 1094806 0.761685 0.753414 0.757522 B.B. PATIL TRS Telangana Rashtra Samithi 508661
6 Andhra Pradesh 6 - Medak 775903 606863 760812 584233 1536715 1191096 0.782138 0.767907 0.775092 KALVAKUNTLA CHANDRASEKHAR RAO TRS Telangana Rashtra Samithi 657492
7 Andhra Pradesh 7 - Malkajgiri 1723413 878093 1459912 742304 3183325 1620397 0.509508 0.508458 0.509027 CH.MALLA REDDY TDP Telugu Desam 523336
8 Andhra Pradesh 8 - Secundrabad 1012378 545749 881269 458020 1893647 1003769 0.539076 0.519728 0.530072 BANDARU DATTATREYA BJP Bharatiya Janata Party 438271
9 Andhra Pradesh 9 - Hyderabad 961290 526510 862374 444911 1823664 971421 0.547712 0.515914 0.532675 ASADUDDIN OWAISI AIMIM All India Majlis-E-Ittehadul Muslimeen 513868
10 Andhra Pradesh 10 - CHELVELLA 1153049 696749 1032130 619113 2185179 1315862 0.604267 0.599840 0.602176 KONDA VISHWESHWAR REDDY TRS Telangana Rashtra Samithi 435077
11 Andhra Pradesh 11 - Mahbubnagar 709711 511764 708961 503036 1418672 1014800 0.721088 0.709540 0.715317 AP JITHENDER REDDY TRS Telangana Rashtra Samithi 334228
12 Andhra Pradesh 12 - Nagarkurnool 745038 570342 732300 538626 1477338 1108968 0.765521 0.735526 0.750653 YELLAIAH NANDI INC Indian National Congress 420075
13 Andhra Pradesh 13 - Nalgonda 747281 602193 748299 587206 1495580 1189399 0.805845 0.784721 0.795276 GUTHA SUKHENDER REDDY INC Indian National Congress 472093
14 Andhra Pradesh 14 - Bhongir 756963 622333 735288 589610 1492251 1211943 0.822145 0.801876 0.812158 DR. BOORA NARSAIAH GOUD TRS Telangana Rashtra Samithi 448245
15 Andhra Pradesh 15 - Warangal 771756 592484 766025 582147 1537781 1174631 0.767709 0.759958 0.763848 KADIYAM SRIHARI TRS Telangana Rashtra Samithi 661639
16 Andhra Pradesh 16 - Mahabubabad 688398 562073 698945 562297 1387343 1124370 0.816494 0.804494 0.810448 PROF. AZMEERA SEETARAM NAIK TRS Telangana Rashtra Samithi 320569
17 Andhra Pradesh 17 - Khammam 712329 588728 727960 594169 1440289 1182897 0.826483 0.816211 0.821291 PONGULETI SRINIVASA REDDY YSRCP Yuvajana Sramika Rythu Congress Party 421957
18 Andhra Pradesh 18 - Aruku 622416 451350 650308 458264 1272724 909614 0.725158 0.704688 0.714699 KOTHAPALLI GEETHA YSRCP Yuvajana Sramika Rythu Congress Party 413191
19 Andhra Pradesh 19 - Srikakulam 706828 505010 707161 546436 1413989 1051446 0.714474 0.772718 0.743603 RAMMOHAN NAIDU KINJARAPU TDP Telugu Desam 556163
20 Andhra Pradesh 20 - Vizianagaram 700837 555005 703290 565311 1404127 1120316 0.791917 0.803809 0.797874 ASHOK GAJAPATHI RAJU PUSAPATI TDP Telugu Desam 536549
21 Andhra Pradesh 21 - Visakhapatnam 875187 585270 847850 578288 1723037 1163558 0.668737 0.682064 0.675295 KAMBHAMPATI HARI BABU BJP Bharatiya Janata Party 566832
22 Andhra Pradesh 22 - Anakapalli 689132 563818 712342 584254 1401474 1148072 0.818157 0.820187 0.819189 MUTTAMSETTI SRINIVASA RAO (AVANTHI) TDP Telugu Desam 568463
23 Andhra Pradesh 23 - Kakinada 709101 558689 709189 541310 1418290 1099999 0.787884 0.763280 0.775581 THOTA NARASIMHAM TDP Telugu Desam 514402
24 Andhra Pradesh 24 - Amalapuram 682607 568534 675259 552393 1357866 1120927 0.832886 0.818046 0.825506 DR PANDULA RAVINDRA BABU TDP Telugu Desam 594547
25 Andhra Pradesh 25 - Rajahmundry 701707 577999 719581 576382 1421288 1154381 0.823704 0.800997 0.812208 MURALI MOHAN MAGANTI TDP Telugu Desam 630573
26 Andhra Pradesh 26 - Narsapuram 652668 539357 672475 549594 1325143 1088951 0.826388 0.817271 0.821761 GOKARAJU GANGA RAJU BJP Bharatiya Janata Party 540306
27 Andhra Pradesh 27 - Eluru 706916 597603 720844 604093 1427760 1201696 0.845366 0.838036 0.841665 MAGANTI VENKATESWARA RAO (BABU) TDP Telugu Desam 623471
28 Andhra Pradesh 28 - Machilipatnam 675774 567908 693537 573157 1369311 1141065 0.840382 0.826426 0.833313 KONAKALLA NARAYANA RAO TDP Telugu Desam 587280
29 Andhra Pradesh 29 - Vijayawada 781156 602198 783357 592877 1564513 1195075 0.770906 0.756841 0.763864 KESINENI SRINIVAS TDP Telugu Desam 592696
30 Andhra Pradesh 30 - Guntur 773027 617483 798989 627443 1572016 1244926 0.798786 0.785296 0.791930 JAYADEV GALLA TDP Telugu Desam 618417
31 Andhra Pradesh 31 - Narasaraopet 748465 638080 766396 643978 1514861 1282058 0.852518 0.840268 0.846321 SAMBASIVA RAO RAYAPATI TDP Telugu Desam 632464
32 Andhra Pradesh 32 - Bapatla 686482 587223 706483 597411 1392965 1184634 0.855409 0.845613 0.850441 MALYADRI SRIRAM TDP Telugu Desam 578145
33 Andhra Pradesh 33 - Ongole 736245 603025 734238 605200 1470483 1208225 0.819055 0.824256 0.821652 Y.V.SUBBA REDDY YSRCP Yuvajana Sramika Rythu Congress Party 589960
34 Andhra Pradesh 34 - Nandyal 783266 603562 793862 601394 1577128 1204956 0.770571 0.757555 0.764019 S.P.Y REDDY YSRCP Yuvajana Sramika Rythu Congress Party 622411
35 Andhra Pradesh 35 - Kurnool 738791 544802 743016 520930 1481807 1065732 0.737424 0.701102 0.719211 BUTTA RENUKA YSRCP Yuvajana Sramika Rythu Congress Party 472782
36 Andhra Pradesh 36 - Anantapur 775509 612890 761403 592164 1536912 1205054 0.790307 0.777727 0.784075 J.C. DIVAKAR REDDI TDP Telugu Desam 606509
37 Andhra Pradesh 37 - Hindupur 734638 601932 711865 575325 1446503 1177257 0.819359 0.808194 0.813864 KRISTAPPA NIMMALA TDP Telugu Desam 604291
38 Andhra Pradesh 38 - Kadapa 765036 588805 785543 611857 1550579 1200662 0.769644 0.778897 0.774331 Y.S. AVINASH REDDY YSRCP Yuvajana Sramika Rythu Congress Party 671983
39 Andhra Pradesh 39 - Nellore 796583 593468 809557 594180 1606140 1187648 0.745017 0.733957 0.739442 MEKAPATI RAJAMOHAN REDDY YSRCP Yuvajana Sramika Rythu Congress Party 576396
40 Andhra Pradesh 40 - Tirupati 778778 604834 795766 608230 1574544 1213064 0.776645 0.764333 0.770422 VARAPRASAD RAO VELAGAPALLI YSRCP Yuvajana Sramika Rythu Congress Party 580376
41 Andhra Pradesh 41 - Rajampet 735347 573019 752151 585298 1487498 1158317 0.779250 0.778166 0.778702 P.V.MIDHUN REDDY YSRCP Yuvajana Sramika Rythu Congress Party 601752
42 Andhra Pradesh 42 - Chittoor 723996 598259 728145 600656 1452141 1198915 0.826329 0.824913 0.825619 NARAMALLI SIVAPRASAD TDP Telugu Desam 594862
43 Arunachal Pradesh 1 - ARUNACHAL WEST 219334 159978 227181 175687 446515 335665 0.729381 0.773335 0.751744 KIREN RIJIJU BJP Bharatiya Janata Party 169367
44 Arunachal Pradesh 2 - ARUNACHAL EAST 160293 129313 152579 131978 312872 261291 0.806729 0.864981 0.835137 NINONG ERING INC Indian National Congress 118455
45 Assam 1 - Karimganj 615198 482484 550799 404436 1165997 886920 0.784274 0.734271 0.760654 RADHESHYAM BISWAS AIUDF All India United Democratic Front 362866
46 Assam 2 - Silchar 554540 428949 505635 370881 1060175 799830 0.773522 0.733496 0.754432 SUSHMITA DEV INC Indian National Congress 336451
47 Assam 3 - Autonomous District 358880 279409 343010 263871 701890 543280 0.778558 0.769281 0.774024 BIREN SINGH ENGTI INC Indian National Congress 213152
48 Assam 4 - Dhubri 798124 709191 754430 660433 1552554 1369624 0.888572 0.875407 0.882175 BADRUDDIN AJMAL AIUDF All India United Democratic Front 592569
49 Assam 5 - Kokrajhar 776071 636657 729405 587212 1505476 1223869 0.820359 0.805056 0.812945 NABA KUMAR SARANIA (HIRA) IND Independent 634428
50 Assam 6 - Barpeta 755559 634405 674616 571458 1430175 1205863 0.839650 0.847086 0.843158 SIRAJ UDDIN AJMAL AIUDF All India United Democratic Front 394702
51 Assam 7 - Gauhati 988067 785494 934203 726235 1922270 1511729 0.794981 0.777385 0.786429 BIJOYA CHAKRAVARTY BJP Bharatiya Janata Party 764985
52 Assam 8 - Mangaldoi 791539 651272 724137 581965 1515676 1233237 0.822792 0.803667 0.813655 RAMEN DEKA BJP Bharatiya Janata Party 486357
53 Assam 9 - Tezpur 654866 505643 604702 475045 1259568 980688 0.772132 0.785585 0.778591 RAM PRASAD SARMAH BJP Bharatiya Janata Party 446511
54 Assam 10 - Nowgong 792424 639392 731457 590682 1523881 1230074 0.806881 0.807542 0.807198 RAJEN GOHAIN BJP Bharatiya Janata Party 494146
55 Assam 11 - Kaliabor 752785 605292 705080 561198 1457865 1166490 0.804070 0.795935 0.800136 GOURAV GOGOI INC Indian National Congress 443315
56 Assam 12 - Jorhat 634236 483829 600212 447507 1234448 931336 0.762853 0.745582 0.754455 KAMAKHYA PRASAD TASA BJP Bharatiya Janata Party 456420
57 Assam 13 - Dibrugarh 579657 462412 544648 428556 1124305 890968 0.797734 0.786849 0.792461 RAMESWAR TELI BJP Bharatiya Janata Party 494364
58 Assam 14 - Lakhimpur 735263 572334 695731 539641 1430994 1111975 0.778407 0.775646 0.777065 SARBANANDA SONOWAL BJP Bharatiya Janata Party 612543
59 Bihar 1 - Valmiki Nagar 786297 484621 670279 415493 1456576 900114 0.616333 0.619881 0.617966 SATISH CHANDRA DUBEY BJP Bharatiya Janata Party 364011
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

543 rows × 15 columns

Calculaing the winning margin


In [17]:
csv_data["Winner Percentage"] = csv_data["Total Votes Polled"] / csv_data["Total Voters"]
csv_data.sort("Winner Percentage", ascending=False)


Out[17]:
State PC Name Male Electors Male Voters Female Electors Female Voters Total Electors Total Voters Male Turnout Female Turnout Total Turnout Candidate Name Party Abbreviation Party Name Total Votes Polled Winner Percentage
138 Gujarat 24 - Surat 803829 539368 680239 408554 1484068 947922 0.670998 0.600604 0.638732 DARSHANA VIKRAM JARDOSH BJP Bharatiya Janata Party 718412 0.757881
134 Gujarat 20 - Vadodara 849077 625045 789244 536532 1638321 1161577 0.736146 0.679805 0.709005 NARENDRA MODI BJP Bharatiya Janata Party 845464 0.727859
139 Gujarat 25 - Navsari 972090 649206 792532 511541 1764622 1160747 0.667846 0.645452 0.657788 C. R. PATIL BJP Bharatiya Janata Party 820831 0.707158
278 Maharashtra 26 - Mumbai North 972645 527803 811225 418759 1783870 946562 0.542647 0.516206 0.530623 GOPAL CHINAYYA SHETTY BJP Bharatiya Janata Party 664004 0.701490
120 Gujarat 6 - Gandhinagar 900744 620889 833228 514606 1733972 1135495 0.689307 0.617605 0.654852 L.K.ADVANI BJP Bharatiya Janata Party 773539 0.681235
355 Rajasthan 7 - Jaipur 1047468 716874 910350 579932 1957818 1296806 0.684387 0.637043 0.662373 RAMCHARAN BOHARA BJP Bharatiya Janata Party 863358 0.665757
241 Madhya Pradesh 18 - VIDISHA 872410 621326 761960 452147 1634370 1073473 0.712195 0.593400 0.656811 SUSHMA SWARAJ BJP Bharatiya Janata Party 714348 0.665455
364 Rajasthan 16 - Jodhpur 910466 600132 816897 478466 1727363 1078598 0.659148 0.585712 0.624419 GAJENDRASINGH SHEKHAWAT BJP Bharatiya Janata Party 713515 0.661521
370 Rajasthan 22 - Rajsamand 879526 508738 819875 473381 1699401 982119 0.578423 0.577382 0.577921 HARIOM SINGH RATHORE BJP Bharatiya Janata Party 644794 0.656533
415 Tripura 2 - Tripura East 581599 489156 558670 461954 1140269 951110 0.841054 0.826882 0.834110 JITENDRA CHOUDHURY CPM Communist Party of India (Marxist) 623771 0.655835
255 Maharashtra 3 - Jalgaon 909027 594892 798906 395440 1707933 990332 0.654427 0.494977 0.579842 A.T. NANA PATIL BJP Bharatiya Janata Party 647773 0.654097
363 Rajasthan 15 - Pali 994082 581099 898948 514488 1893030 1095587 0.584558 0.572322 0.578748 P P CHOUDHARY BJP Bharatiya Janata Party 711772 0.649672
310 NCT OF Delhi 4 - NEW DELHI 830322 546295 659825 423517 1490147 969812 0.657932 0.641863 0.650816 UDIT RAJ BJP Bharatiya Janata Party 629860 0.649466
249 Madhya Pradesh 26 - INDORE 1106461 736759 1008842 580058 2115303 1316817 0.665870 0.574974 0.622519 SUMITRA MAHAJAN (TAI) BJP Bharatiya Janata Party 854972 0.649272
240 Madhya Pradesh 17 - HOSHANGABAD 835492 593957 732635 437218 1568127 1031175 0.710907 0.596775 0.657584 UDAY PRATAP SINGH BJP Bharatiya Janata Party 669128 0.648899
313 NCT OF Delhi 7 - SOUTH DELHI 1005289 638406 747452 464004 1752741 1102410 0.635047 0.620781 0.628963 NEIPHIU RIO NPF Naga Peoples Front 713372 0.647102
121 Gujarat 7 - Ahmedabad East 852765 560074 749067 425451 1601832 985525 0.656774 0.567975 0.615249 PARESH RAWAL BJP Bharatiya Janata Party 633582 0.642888
122 Gujarat 8 - Ahmedabad West 800933 534008 733467 430601 1534400 964609 0.666732 0.587076 0.628656 DR. KIRIT P SOLANKI BJP Bharatiya Janata Party 617104 0.639745
451 Uttar Pradesh 36 - Rae Bareli 857875 437735 737079 387401 1594954 825136 0.510255 0.525590 0.517342 SONIA GANDHI INC Indian National Congress 526434 0.637997
242 Madhya Pradesh 19 - BHOPAL 1039004 639683 917932 490499 1956936 1130182 0.615669 0.534352 0.577526 ALOK SANJAR BJP Bharatiya Janata Party 714178 0.631914
245 Madhya Pradesh 22 - UJJAIN 790889 571525 734592 444880 1525481 1016405 0.722636 0.605615 0.666285 PROF. CHINTAMANI MALVIYA BJP Bharatiya Janata Party 641101 0.630753
350 Rajasthan 2 - Bikaner 847064 526983 744004 402768 1591068 929751 0.622129 0.541352 0.584357 ARJUN RAM MEGHWAL BJP Bharatiya Janata Party 584932 0.629128
125 Gujarat 11 - Porbandar 807383 471495 731840 337938 1539223 809433 0.583979 0.461765 0.525871 RADADIYA VITHALBHAI HANSRAJBHAI BJP Bharatiya Janata Party 508437 0.628140
414 Tripura 1 - Tripura West 635976 546566 612574 526183 1248550 1072749 0.859413 0.858971 0.859196 SANKAR PRASAD DATTA CPM Communist Party of India (Marxist) 671665 0.626116
354 Rajasthan 6 - Jaipur Rural 906275 554084 793187 459607 1699462 1013691 0.611386 0.579443 0.596478 RAJYAVARDHAN SINGH RATHORE BJP Bharatiya Janata Party 632930 0.624382
252 Madhya Pradesh 29 - BETUL 836835 574150 770987 473569 1607822 1047719 0.686097 0.614237 0.651639 JYOTI DHURVE BJP Bharatiya Janata Party 643651 0.614336
280 Maharashtra 28 - Mumbai North East 923016 485775 745341 375986 1668357 861761 0.526291 0.504448 0.516533 KIRIT SOMAIYA BJP Bharatiya Janata Party 525285 0.609548
307 NCT OF Delhi 1 - CHANDNI CHOWK 791317 550825 655911 431038 1447228 981863 0.696086 0.657159 0.678444 MANOJ TIWARI BJP Bharatiya Janata Party 596125 0.607137
356 Rajasthan 8 - Alwar 871339 587242 756728 475063 1628067 1062305 0.673954 0.627786 0.652495 CHAND NATH BJP Bharatiya Janata Party 642278 0.604608
332 Orissa 19 - Aska 750999 449485 657781 446796 1408780 896281 0.598516 0.679247 0.636211 LADU KISHORE SWAIN BJD Biju Janata Dal 541473 0.604133
357 Rajasthan 9 - BHARATPUR 911069 548105 775828 414327 1686897 962432 0.601606 0.534045 0.570534 BAHADUR SINGH BJP Bharatiya Janata Party 579825 0.602458
246 Madhya Pradesh 23 - MANDSOUR 838076 640484 788495 520865 1626571 1161349 0.764231 0.660581 0.713986 SUDHIR GUPTA BJP Bharatiya Janata Party 698335 0.601314
256 Maharashtra 4 - Raver 842682 554159 750688 455054 1593370 1009213 0.657613 0.606183 0.633383 KHADASE RAKSHA NIKHIL BJP Bharatiya Janata Party 605452 0.599925
369 Rajasthan 21 - Chittorgarh 928572 632047 889575 540582 1818147 1172629 0.680666 0.607686 0.644958 CHANDRA PRAKASH JOSHI BJP Bharatiya Janata Party 703236 0.599709
129 Gujarat 15 - Bhavnagar 834571 519525 759960 397877 1594531 917402 0.622505 0.523550 0.575343 DR. BHARATIBEN DHIRUBHAI SHIYAL BJP Bharatiya Janata Party 549529 0.599006
429 Uttar Pradesh 14 - Bulandshahr 930831 549484 805616 460226 1736447 1009710 0.590316 0.571272 0.581480 BHOLA SINGH BJP Bharatiya Janata Party 604449 0.598636
436 Uttar Pradesh 21 - Mainpuri 900568 580173 752497 419092 1653065 999265 0.644230 0.556935 0.604492 MULAYAM SINGH YADAV SP Samajwadi Party 595918 0.596356
115 Gujarat 1 - Kachchh 806343 520905 727439 425335 1533782 946240 0.646009 0.584702 0.616933 CHAVDA VINOD LAKHAMASHI BJP Bharatiya Janata Party 562855 0.594833
497 Uttarakhand 2 - Garhwal 652891 323143 616192 358881 1269083 682024 0.494942 0.582417 0.537415 (MAJ GEN (RETD.) ) BHUWAN CHANDRA KHANDURI (AVSM) BJP Bharatiya Janata Party 405690 0.594832
131 Gujarat 17 - Kheda 833232 542955 766244 412951 1599476 955906 0.651625 0.538929 0.597637 CHAUHAN DEVUSINH JESINGBHAI (CHAUHAN DEVUSINH) BJP Bharatiya Janata Party 568235 0.594447
288 Maharashtra 36 - Shirur 973236 613828 850876 475678 1824112 1089506 0.630708 0.559045 0.597280 ADHALRAO SHIVAJI DATTATREY SHS Shivsena 643415 0.590557
243 Madhya Pradesh 20 - RAJGARH 827001 598652 751747 412072 1578748 1010724 0.723883 0.548153 0.640206 RODMAL NAGAR BJP Bharatiya Janata Party 596727 0.590396
418 Uttar Pradesh 3 - Muzaffarnagar 875186 620606 713297 486828 1588483 1107434 0.709113 0.682504 0.697165 (DR.) SANJEEV KUMAR BALYAN BJP Bharatiya Janata Party 653391 0.590004
373 Rajasthan 25 - JHALAWAR-BARAN 868977 635659 800865 510705 1669842 1146364 0.731503 0.637692 0.686510 DUSHYANT SINGH BJP Bharatiya Janata Party 676102 0.589780
124 Gujarat 10 - Rajkot 864760 593333 790957 463736 1655717 1057069 0.686124 0.586297 0.638436 KUNDARIYA MOHANBHAI KALYANJIBHAI BJP Bharatiya Janata Party 621524 0.587969
113 Goa 1 - North Goa 255870 200184 259571 206447 515441 406631 0.782366 0.795339 0.788899 SHRIPAD YESSO NAIK BJP Bharatiya Janata Party 237903 0.585059
296 Maharashtra 44 - Sangli 861582 558707 787525 487952 1649107 1046659 0.648466 0.619602 0.634682 SANJAYKAKA PATIL BJP Bharatiya Janata Party 611563 0.584300
293 Maharashtra 41 - Latur 897919 578053 784688 479103 1682607 1057156 0.643770 0.610565 0.628285 DR. SUNIL BALIRAM GAIKWAD BJP Bharatiya Janata Party 616509 0.583177
244 Madhya Pradesh 21 - DEWAS 843555 654121 773660 489847 1617215 1143968 0.775434 0.633155 0.707369 MANOHAR UNTWAL BJP Bharatiya Janata Party 665646 0.581875
499 Uttarakhand 4 - Nainital-udhamsingh Nagar 857781 590700 753029 510735 1610810 1101435 0.688637 0.678241 0.683777 BHAGAT SINGH KOSHYARI BJP Bharatiya Janata Party 636769 0.578127
118 Gujarat 4 - Mahesana 777821 544710 720398 459548 1498219 1004258 0.700303 0.637908 0.670301 PATEL JAYSHREEBEN KANUBHAI BJP Bharatiya Janata Party 580250 0.577790
150 Haryana 10 - Faridabad 969407 651411 770945 479315 1740352 1130726 0.671969 0.621724 0.649711 KRISHAN PAL BJP Bharatiya Janata Party 652516 0.577077
496 Uttarakhand 1 - Tehri Garhwal 712039 403088 640806 373126 1352845 776214 0.566104 0.582276 0.573764 MALA RAJYA LAXMI SHAH BJP Bharatiya Janata Party 446733 0.575528
286 Maharashtra 34 - Pune 949567 533686 886269 459588 1835836 993274 0.562031 0.518565 0.541047 ANIL SHIROLE BJP Bharatiya Janata Party 569825 0.573684
116 Gujarat 2 - Banaskantha 796124 513893 719587 372741 1515711 886634 0.645494 0.517993 0.584962 CHAUDHARY HARIBHAI PARTHIBHAI BJP Bharatiya Janata Party 507856 0.572791
290 Maharashtra 38 - Shirdi 765921 520229 693791 412416 1459712 932645 0.679220 0.594438 0.638924 LOKHANDE SADASHIV KISAN SHS Shivsena 532936 0.571424
371 Rajasthan 23 - Bhilwara 904030 581524 850847 522566 1754877 1104090 0.643257 0.614172 0.629155 SUBHASH BAHERIA BJP Bharatiya Janata Party 630317 0.570893
151 Himachal Pradesh 1 - Kangra 645888 392927 612713 406518 1258601 799445 0.608352 0.663472 0.635185 SHANTA KUMAR BJP Bharatiya Janata Party 456163 0.570600
251 Madhya Pradesh 28 - KHANDWA 912747 677574 846663 579753 1759410 1257327 0.742346 0.684751 0.714630 NANDKUMAR SINGH CHOUHAN (NANDU BHAIYA) BJP Bharatiya Janata Party 717357 0.570541
289 Maharashtra 37 - Ahmadnagar 898819 595960 800589 466358 1699408 1062318 0.663048 0.582519 0.625111 GANDHI DILIPKUMAR MANSUKHLAL BJP Bharatiya Janata Party 605185 0.569683
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

543 rows × 16 columns

Analyzing Winners By Party


In [18]:
results = pd.DataFrame(csv_data["Party Abbreviation"].value_counts(), columns=["Seats"])
results["Seats Percentage"] = results["Seats"] / len(winners)
results


Out[18]:
Seats Seats Percentage
BJP 282 0.519337
INC 44 0.081031
ADMK 37 0.068140
AITC 34 0.062615
BJD 20 0.036832
SHS 18 0.033149
TDP 16 0.029466
TRS 11 0.020258
CPM 9 0.016575
YSRCP 9 0.016575
LJP 6 0.011050
NCP 6 0.011050
SP 5 0.009208
AAAP 4 0.007366
RJD 4 0.007366
SAD 4 0.007366
AIUDF 3 0.005525
IND 3 0.005525
BLSP 3 0.005525
JKPDP 3 0.005525
INLD 2 0.003683
JMM 2 0.003683
IUML 2 0.003683
JD(U) 2 0.003683
AD 2 0.003683
JD(S) 2 0.003683
RSP 1 0.001842
KEC(M) 1 0.001842
CPI 1 0.001842
SDF 1 0.001842
AINRC 1 0.001842
SWP 1 0.001842
NPEP 1 0.001842
AIMIM 1 0.001842
NPF 1 0.001842
PMK 1 0.001842

36 rows × 2 columns


In [19]:
all_votes = pd.pivot_table(results_data, values="Total Votes Polled", rows="Party Abbreviation", aggfunc="sum")
all_votes_average = pd.pivot_table(results_data, values="Total Votes Polled", rows="Party Abbreviation", aggfunc="mean")

In [20]:
get_total_votes = lambda x: all_votes[x]
get_average_votes = lambda x: all_votes_average[x]

results["Total Votes"] = pd.Series(results.index.values).apply(get_total_votes).values
results["Average Votes"] = pd.Series(results.index.values).apply(get_average_votes).values
results


Out[20]:
Seats Seats Percentage Total Votes Average Votes
BJP 282 0.519337 171657549 401069.039720
INC 44 0.081031 106938242 230470.349138
ADMK 37 0.068140 18115825 452895.625000
AITC 34 0.062615 21259681 162287.641221
BJD 20 0.036832 9491497 451976.047619
SHS 18 0.033149 10262982 176947.965517
TDP 16 0.029466 14094545 469818.166667
TRS 11 0.020258 6736490 396264.117647
CPM 9 0.016575 17986773 193406.161290
YSRCP 9 0.016575 13991280 368191.578947
LJP 6 0.011050 2295929 327989.857143
NCP 6 0.011050 8635554 239876.500000
SP 5 0.009208 18672916 94786.375635
AAAP 4 0.007366 11325635 26216.747685
RJD 4 0.007366 7442313 248077.100000
SAD 4 0.007366 3636148 363614.800000
AIUDF 3 0.005525 2333040 129613.333333
IND 3 0.005525 16743719 5175.801855
BLSP 3 0.005525 1078473 269618.250000
JKPDP 3 0.005525 732644 146528.800000
INLD 2 0.003683 2799899 279989.900000
JMM 2 0.003683 1637990 77999.523810
IUML 2 0.003683 1100096 44003.840000
JD(U) 2 0.003683 5992196 64432.215054
AD 2 0.003683 821820 117402.857143
JD(S) 2 0.003683 3731481 109749.441176
RSP 1 0.001842 1666380 277730.000000
KEC(M) 1 0.001842 424194 424194.000000
CPI 1 0.001842 4327298 64586.537313
SDF 1 0.001842 163698 163698.000000
AINRC 1 0.001842 255826 255826.000000
SWP 1 0.001842 1105073 552536.500000
NPEP 1 0.001842 576444 82349.142857
AIMIM 1 0.001842 685729 137145.800000
NPF 1 0.001842 994505 497252.500000
PMK 1 0.001842 1827566 203062.888889

36 rows × 4 columns

Calculating votes that resulted in winning seats


In [21]:
all_winning_votes = pd.pivot_table(csv_data, values="Total Votes Polled", rows="Party Abbreviation", aggfunc="sum")
all_winning_votes_average = pd.pivot_table(csv_data, values="Total Votes Polled", rows="Party Abbreviation", aggfunc="mean")
all_winning_votes_percentages = pd.pivot_table(csv_data, values="Winner Percentage", rows="Party Abbreviation", aggfunc="mean")
average_winning_elecors = pd.pivot_table(csv_data, values="Total Electors", rows="Party Abbreviation", aggfunc="mean")

In [22]:
get_total_winning_votes = lambda x: all_winning_votes[x]
get_average_winning_votes = lambda x: all_winning_votes_average[x]
get_average_winning_percentages = lambda x: all_winning_votes_percentages[x]
get_average_winning_elecors = lambda x: average_winning_elecors[x]


results["Total Winning Votes"] = pd.Series(results.index.values).apply(get_total_winning_votes).values
results["Average Winning Votes"] = pd.Series(results.index.values).apply(get_average_winning_votes).values
results["Average Winning Percentage"] = pd.Series(results.index.values).apply(get_average_winning_percentages).values
results["Average Winning Electors"] = pd.Series(results.index.values).apply(get_average_winning_elecors).values

results["Loosing Votes"] = results["Total Votes"] - results["Total Winning Votes"]
results["Winning Votes Ratio"] = results["Total Winning Votes"] / results["Total Votes"]

results


Out[22]:
Seats Seats Percentage Total Votes Average Votes Total Winning Votes Average Winning Votes Average Winning Percentage Average Winning Electors Loosing Votes Winning Votes Ratio
BJP 282 0.519337 171657549 401069.039720 139553310 494869 0.493188 1606886 32104239 0.812975
INC 44 0.081031 106938242 230470.349138 18219598 414081 0.428075 1384055 88718644 0.170375
ADMK 37 0.068140 18115825 452895.625000 17415881 470699 0.451634 1413200 699944 0.961363
AITC 34 0.062615 21259681 162287.641221 18366652 540195 0.431486 1512020 2893029 0.863919
BJD 20 0.036832 9491497 451976.047619 9169818 458490 0.449398 1389275 321679 0.966109
SHS 18 0.033149 10262982 176947.965517 9010919 500606 0.510340 1676883 1252063 0.878002
TDP 16 0.029466 14094545 469818.166667 9362168 585135 0.493163 1554833 4732377 0.664241
TRS 11 0.020258 6736490 396264.117647 5307344 482485 0.430386 1532891 1429146 0.787850
CPM 9 0.016575 17986773 193406.161290 4069667 452185 0.455675 1264327 13917106 0.226259
YSRCP 9 0.016575 13991280 368191.578947 4950808 550089 0.478040 1495688 9040472 0.353850
LJP 6 0.011050 2295929 327989.857143 1983574 330595 0.375127 1579884 312355 0.863953
NCP 6 0.011050 8635554 239876.500000 2594704 432450 0.483694 1419258 6040850 0.300468
SP 5 0.009208 18672916 94786.375635 2458349 491669 0.471728 1714211 16214567 0.131653
AAAP 4 0.007366 11325635 26216.747685 1716952 429238 0.401053 1464262 9608683 0.151599
RJD 4 0.007366 7442313 248077.100000 1429688 357422 0.367278 1636930 6012625 0.192103
SAD 4 0.007366 3636148 363614.800000 1817385 454346 0.411916 1543844 1818763 0.499811
AIUDF 3 0.005525 2333040 129613.333333 1350137 450045 0.389700 1382908 982903 0.578703
IND 3 0.005525 16743719 5175.801855 1374887 458295 0.463283 1271567 15368832 0.082114
BLSP 3 0.005525 1078473 269618.250000 1072804 357601 0.427755 1522716 5669 0.994743
JKPDP 3 0.005525 732644 146528.800000 533629 177876 0.472012 1232333 199015 0.728361
INLD 2 0.003683 2799899 279989.900000 1000848 500424 0.411830 1589081 1799051 0.357459
JMM 2 0.003683 1637990 77999.523810 715322 357661 0.385344 1300163 922668 0.436707
IUML 2 0.003683 1100096 44003.840000 816226 408113 0.473571 1189616 283870 0.741959
JD(U) 2 0.003683 5992196 64432.215054 740808 370404 0.380420 1767467 5251388 0.123629
AD 2 0.003683 821820 117402.857143 812325 406162 0.426682 1718643 9495 0.988446
JD(S) 2 0.003683 3731481 109749.441176 1034211 517105 0.442053 1615299 2697270 0.277158
RSP 1 0.001842 1666380 277730.000000 408528 408528 0.464735 1219415 1257852 0.245159
KEC(M) 1 0.001842 424194 424194.000000 424194 424194 0.510072 1161463 0 1.000000
CPI 1 0.001842 4327298 64586.537313 389209 389209 0.422821 1275288 3938089 0.089943
SDF 1 0.001842 163698 163698.000000 163698 163698 0.529824 370611 0 1.000000
AINRC 1 0.001842 255826 255826.000000 255826 255826 0.345703 901357 0 1.000000
SWP 1 0.001842 1105073 552536.500000 640428 640428 0.538686 1630598 464645 0.579535
NPEP 1 0.001842 576444 82349.142857 239301 239301 0.522410 586501 337143 0.415133
AIMIM 1 0.001842 685729 137145.800000 513868 513868 0.528986 1823664 171861 0.749375
NPF 1 0.001842 994505 497252.500000 713372 713372 0.647102 1752741 281133 0.717314
PMK 1 0.001842 1827566 203062.888889 468194 468194 0.425111 1358273 1359372 0.256184

36 rows × 10 columns

Statistical Analysis of Results


In [23]:
results.describe()


Out[23]:
Seats Seats Percentage Total Votes Average Votes Total Winning Votes Average Winning Votes Average Winning Percentage Average Winning Electors Loosing Votes Winning Votes Ratio
count 36.000000 36.000000 3.600000e+01 36.000000 3.600000e+01 36.000000 36.000000 36.000000 36.000000 36.000000
mean 15.083333 0.027778 1.365393e+07 236299.539018 7.252629e+06 435134.944444 0.453897 1412726.416667 6401299.944444 0.560735
std 46.987156 0.086533 3.248419e+07 150275.821702 2.324585e+07 113343.272362 0.059478 305902.010647 15550652.495029 0.323618
min 1.000000 0.001842 1.636980e+05 5175.801855 1.636980e+05 163698.000000 0.345703 370611.000000 0.000000 0.082114
25% 1.000000 0.001842 1.094690e+06 115489.503151 6.137282e+05 384507.750000 0.420095 1274357.750000 305233.750000 0.253428
50% 3.000000 0.005525 3.683814e+06 216766.619013 1.211470e+06 451115.000000 0.450516 1479975.000000 1308612.000000 0.579119
75% 9.000000 0.016575 1.199205e+07 364758.994737 4.289952e+06 496257.750000 0.486061 1608989.250000 5441697.250000 0.863928
max 282.000000 0.519337 1.716575e+08 552536.500000 1.395533e+08 713372.000000 0.647102 1823664.000000 88718644.000000 1.000000

8 rows × 10 columns

Visualizing the results


In [24]:
import matplotlib.pyplot as plt

In [25]:
plt.figure(figsize=(18,8))
cmap = plt.cm.hsv
colors = cmap(np.linspace(0., 1., len(results["Seats"])))
plt.pie(results["Seats"], labels=results.index, explode=np.array(range(len(results)))/10, autopct='%1.1f%%',
        colors = colors)

plt.axis("equal")

plt.title("Indian general election 2014 results of seats per party")

plt.show();



In [26]:
plt.figure(figsize=(18,8))

plt.pie(results.sort("Total Votes", ascending=False)["Total Votes"], labels=results.sort("Total Votes", ascending=False).index,
        explode=np.array(range(len(results)))**1.5/40, autopct='%1.1f%%', colors = colors)

plt.axis("equal")

plt.title("Indian general election 2014 results of votes per party")

plt.show();



In [27]:
plt.figure(figsize=(18,10))
for counter in range(len(results)):
    x = results["Total Votes"][counter]
    y = results["Seats"][counter]
    label = "%s\n%s" % (results.index[counter], y)
    plt.scatter(x,y, c = colors[counter],
                s=y/x * 1e9, label =results.index[counter])
    plt.annotate(label, 
        xy = (x, y), xytext = (-20, 20),
        textcoords = 'offset points', ha = 'right', va = 'bottom',
        bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),
        arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))

plt.xscale("log")
plt.yscale("log")
plt.xlim(results["Total Votes"].min()*0.95, results["Total Votes"].max()*1.05)
plt.ylim(0)

plt.xlabel("Total Votes (log)")
plt.ylabel("Seats (log)")

plt.title("Indian General Elections 2014 Seats vs Total Votes on a log scale")

plt.grid()

plt.show();



In [28]:
print results


        Seats  Seats Percentage  Total Votes  Average Votes  \
BJP       282          0.519337    171657549  401069.039720   
INC        44          0.081031    106938242  230470.349138   
ADMK       37          0.068140     18115825  452895.625000   
AITC       34          0.062615     21259681  162287.641221   
BJD        20          0.036832      9491497  451976.047619   
SHS        18          0.033149     10262982  176947.965517   
TDP        16          0.029466     14094545  469818.166667   
TRS        11          0.020258      6736490  396264.117647   
CPM         9          0.016575     17986773  193406.161290   
YSRCP       9          0.016575     13991280  368191.578947   
LJP         6          0.011050      2295929  327989.857143   
NCP         6          0.011050      8635554  239876.500000   
SP          5          0.009208     18672916   94786.375635   
AAAP        4          0.007366     11325635   26216.747685   
RJD         4          0.007366      7442313  248077.100000   
SAD         4          0.007366      3636148  363614.800000   
AIUDF       3          0.005525      2333040  129613.333333   
IND         3          0.005525     16743719    5175.801855   
BLSP        3          0.005525      1078473  269618.250000   
JKPDP       3          0.005525       732644  146528.800000   
INLD        2          0.003683      2799899  279989.900000   
JMM         2          0.003683      1637990   77999.523810   
IUML        2          0.003683      1100096   44003.840000   
JD(U)       2          0.003683      5992196   64432.215054   
AD          2          0.003683       821820  117402.857143   
JD(S)       2          0.003683      3731481  109749.441176   
RSP         1          0.001842      1666380  277730.000000   
KEC(M)      1          0.001842       424194  424194.000000   
CPI         1          0.001842      4327298   64586.537313   
SDF         1          0.001842       163698  163698.000000   
AINRC       1          0.001842       255826  255826.000000   
SWP         1          0.001842      1105073  552536.500000   
NPEP        1          0.001842       576444   82349.142857   
AIMIM       1          0.001842       685729  137145.800000   
NPF         1          0.001842       994505  497252.500000   
PMK         1          0.001842      1827566  203062.888889   

        Total Winning Votes  Average Winning Votes  \
BJP               139553310                 494869   
INC                18219598                 414081   
ADMK               17415881                 470699   
AITC               18366652                 540195   
BJD                 9169818                 458490   
SHS                 9010919                 500606   
TDP                 9362168                 585135   
TRS                 5307344                 482485   
CPM                 4069667                 452185   
YSRCP               4950808                 550089   
LJP                 1983574                 330595   
NCP                 2594704                 432450   
SP                  2458349                 491669   
AAAP                1716952                 429238   
RJD                 1429688                 357422   
SAD                 1817385                 454346   
AIUDF               1350137                 450045   
IND                 1374887                 458295   
BLSP                1072804                 357601   
JKPDP                533629                 177876   
INLD                1000848                 500424   
JMM                  715322                 357661   
IUML                 816226                 408113   
JD(U)                740808                 370404   
AD                   812325                 406162   
JD(S)               1034211                 517105   
RSP                  408528                 408528   
KEC(M)               424194                 424194   
CPI                  389209                 389209   
SDF                  163698                 163698   
AINRC                255826                 255826   
SWP                  640428                 640428   
NPEP                 239301                 239301   
AIMIM                513868                 513868   
NPF                  713372                 713372   
PMK                  468194                 468194   

        Average Winning Percentage  Average Winning Electors  Loosing Votes  \
BJP                       0.493188                   1606886       32104239   
INC                       0.428075                   1384055       88718644   
ADMK                      0.451634                   1413200         699944   
AITC                      0.431486                   1512020        2893029   
BJD                       0.449398                   1389275         321679   
SHS                       0.510340                   1676883        1252063   
TDP                       0.493163                   1554833        4732377   
TRS                       0.430386                   1532891        1429146   
CPM                       0.455675                   1264327       13917106   
YSRCP                     0.478040                   1495688        9040472   
LJP                       0.375127                   1579884         312355   
NCP                       0.483694                   1419258        6040850   
SP                        0.471728                   1714211       16214567   
AAAP                      0.401053                   1464262        9608683   
RJD                       0.367278                   1636930        6012625   
SAD                       0.411916                   1543844        1818763   
AIUDF                     0.389700                   1382908         982903   
IND                       0.463283                   1271567       15368832   
BLSP                      0.427755                   1522716           5669   
JKPDP                     0.472012                   1232333         199015   
INLD                      0.411830                   1589081        1799051   
JMM                       0.385344                   1300163         922668   
IUML                      0.473571                   1189616         283870   
JD(U)                     0.380420                   1767467        5251388   
AD                        0.426682                   1718643           9495   
JD(S)                     0.442053                   1615299        2697270   
RSP                       0.464735                   1219415        1257852   
KEC(M)                    0.510072                   1161463              0   
CPI                       0.422821                   1275288        3938089   
SDF                       0.529824                    370611              0   
AINRC                     0.345703                    901357              0   
SWP                       0.538686                   1630598         464645   
NPEP                      0.522410                    586501         337143   
AIMIM                     0.528986                   1823664         171861   
NPF                       0.647102                   1752741         281133   
PMK                       0.425111                   1358273        1359372   

        Winning Votes Ratio  
BJP                0.812975  
INC                0.170375  
ADMK               0.961363  
AITC               0.863919  
BJD                0.966109  
SHS                0.878002  
TDP                0.664241  
TRS                0.787850  
CPM                0.226259  
YSRCP              0.353850  
LJP                0.863953  
NCP                0.300468  
SP                 0.131653  
AAAP               0.151599  
RJD                0.192103  
SAD                0.499811  
AIUDF              0.578703  
IND                0.082114  
BLSP               0.994743  
JKPDP              0.728361  
INLD               0.357459  
JMM                0.436707  
IUML               0.741959  
JD(U)              0.123629  
AD                 0.988446  
JD(S)              0.277158  
RSP                0.245159  
KEC(M)             1.000000  
CPI                0.089943  
SDF                1.000000  
AINRC              1.000000  
SWP                0.579535  
NPEP               0.415133  
AIMIM              0.749375  
NPF                0.717314  
PMK                0.256184  

[36 rows x 10 columns]

In [28]: